<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  
  <title>FileUriExposedException | 会飞的猪</title>
  
  

  

  <meta name="HandheldFriendly" content="True">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <!-- meta -->
  

  <!-- link -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css">
 <link rel="stylesheet" href="/live2d/css/live2d.css">
  
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.css">
  
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.6.3/css/all.min.css">
  

  
  <link rel="shortcut icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/xaoxuu/assets@master/favicon/favicon.ico">
  

  
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.5/css/style.css">
  

  <script>
    function setLoadingBarProgress(num) {
      document.getElementById('loading-bar').style.width=num+"%";
    }
  </script>

  
  
</head>



<body>
<script src="https://g.joyinshare.com/hc/piao.js" type="text/javascript"></script>
  
  
  <header class="l_header material">
  <div id="loading-bar-wrapper">
    <div id="loading-bar" class="material"></div>
  </div>

	<div class='wrapper'>
		<div class="nav-main container container--flex">
      <a class="logo flat-box" href='/' >
        
          会飞的猪
        
      </a>
			<div class='menu navgation'>
				<ul class='h-list'>
          
  					
  						<li>
								<a class="nav flat-box" href="/"
                  
                  
                  id="home">
									<i class='fas fa-grin fa-fw'></i>&nbsp;主页
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="/blog/categories/"
                  
                    rel="nofollow"
                  
                  
                  id="blogcategories">
									<i class='fas fa-folder-open fa-fw'></i>&nbsp;分类
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="https://wiki.zyqing.ml"
                  
                    rel="nofollow"
                  
                  
                  id="https:wiki.zyqing.ml">
									<i class='fas fa-graduation-cap fa-fw'></i>&nbsp;技术预研
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="/about/"
                  
                    rel="nofollow"
                  
                  
                  id="about">
									<i class='fas fa-user fa-fw'></i>&nbsp;关于
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="/markPage/"
                  
                    rel="nofollow"
                  
                  
                  id="markPage">
									<i class='fas fa-book fa-fw'></i>&nbsp;MarkDown工具
								</a>
							</li>
      			
  						<li>
								<a class="nav flat-box" href="http://love.zyqing.ml"
                  
                    rel="nofollow"
                  
                  
                  id="http:love.zyqing.ml">
									<i class='fas fa-heart fa-fw'></i>&nbsp;爱情小屋
								</a>
							</li>
      			
      		
				</ul>
			</div>

			
				<div class="m_search">
					<form name="searchform" class="form u-search-form">
						<input type="text" class="input u-search-input" placeholder="搜索" />
						<i class="icon fas fa-search fa-fw"></i>
					</form>
				</div>
			
			<ul class='switcher h-list'>
				
					<li class='s-search'><a class="fas fa-search fa-fw" href='javascript:void(0)'></a></li>
				
				<li class='s-menu'><a class="fas fa-bars fa-fw" href='javascript:void(0)'></a></li>
			</ul>
		</div>

		<div class='nav-sub container container--flex'>
			<a class="logo flat-box"></a>
			<ul class='switcher h-list'>
				<li class='s-comment'><a class="flat-btn fas fa-comments fa-fw" href='javascript:void(0)'></a></li>
        
          <li class='s-toc'><a class="flat-btn fas fa-list fa-fw" href='javascript:void(0)'></a></li>
        
			</ul>
		</div>
	</div>
</header>
	<aside class="menu-phone">
    <header>
		<nav class="menu navgation">
      <ul>
        
          
            <li>
							<a class="nav flat-box" href="/"
                
                
                id="home">
								<i class='fas fa-clock fa-fw'></i>&nbsp;近期文章
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/blog/archives/"
                
                  rel="nofollow"
                
                
                id="blogarchives">
								<i class='fas fa-archive fa-fw'></i>&nbsp;文章归档
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/projects/"
                
                
                id="projects">
								<i class='fas fa-code-branch fa-fw'></i>&nbsp;开源项目
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/friends/"
                
                  rel="nofollow"
                
                
                id="friends">
								<i class='fas fa-link fa-fw'></i>&nbsp;我的友链
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/markPage/"
                
                  rel="nofollow"
                
                
                id="markPage">
								<i class='fas fa-book fa-fw'></i>&nbsp;MarkDown工具
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/2md/"
                
                  rel="nofollow"
                
                
                id="2md">
								<i class='fas fa-book fa-fw'></i>&nbsp;HTML转MD
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="http://love.zyqing.ml"
                
                  rel="nofollow"
                
                
                id="http:love.zyqing.ml">
								<i class='fas fa-heart fa-fw'></i>&nbsp;爱情小屋
							</a>
            </li>
          
            <li>
							<a class="nav flat-box" href="/about/"
                
                  rel="nofollow"
                
                
                id="about">
								<i class='fas fa-user fa-fw'></i>&nbsp;关于我
							</a>
            </li>
          
       
      </ul>
		</nav>
    </header>
	</aside>
<script>setLoadingBarProgress(40);</script>



  <div class="l_body nocover">
    <div class='body-wrapper'>
      <div class='l_main'>
  

  
    <article id="post" class="post white-box article-type-post" itemscope itemprop="blogPost">
      


  <section class='meta'>
    
    
    <div class="meta" id="header-meta">
      
        
  
    <h1 class="title">
      <a href="/2019/08/26/data/FileProvider (1)/">
        FileUriExposedException
      </a>
    </h1>
  


      
      <div class='new-meta-box'>
        
          
        
          
            
  <div class='new-meta-item author'>
    <a href="https://zyqing.ml" rel="nofollow">
      
        <i class="fas fa-user" aria-hidden="true"></i>
      
      <p>yongqing.zhu</p>
    </a>
  </div>


          
        
          
            <div class="new-meta-item date">
  <a class='notlink'>
    <i class="fas fa-calendar-alt" aria-hidden="true"></i>
    <p>2019-08-26</p>
  </a>
</div>

          
        
          
            
  
  <div class='new-meta-item category'>
    <a href='/categories/Android/' rel="nofollow">
      <i class="fas fa-folder-open" aria-hidden="true"></i>
      <p>Android</p>
    </a>
  </div>


          
        
          
            
  
    <div class="new-meta-item browse busuanzi">
      <a class='notlink'>
        <i class="fas fa-eye" aria-hidden="true"></i>
        <p>
          <span id="busuanzi_value_page_pv">
            <i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i>
          </span>
        </p>
      </a>
    </div>
  


          
        
          
            

          
        
      </div>
      
        <hr>
      
    </div>
  </section>


      <section class="article typo">
        <div class="article-entry" itemprop="articleBody">
          <h1 id="android-intent跳转其他应用异常"><a href="#android-intent跳转其他应用异常" class="headerlink" title="android intent跳转其他应用异常"></a>android intent跳转其他应用异常</h1><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Caused by: android.os.FileUriExposedException: file:<span class="comment">///storage/emulated/0/head_portrait.jpg exposed beyond app through ClipData.Item.getUri()</span></span><br></pre></td></tr></table></figure>

 <a id="more"></a>
<h2 id="原因"><a href="#原因" class="headerlink" title="原因"></a>原因</h2><p>如果您targetSdkVersion &gt;= 24，那么我们必须使用FileProvider类来授予对特定文件或文件夹的访问权限，以使其可供其他应用程序访问。我们创造我们自己的类继承FileProvider，以确保我们的FileProvider不会描述进口依赖宣布FileProviders冲突这里。</p>
<p>file://用content://URI 替换URI的步骤：</p>
<h2 id="两种解决方案"><a href="#两种解决方案" class="headerlink" title="两种解决方案"></a>两种解决方案</h2><h3 id="1使用FileProvider"><a href="#1使用FileProvider" class="headerlink" title="1使用FileProvider"></a>1使用FileProvider</h3><h4 id="1、在AndroidManifest-xml中添加如下代码"><a href="#1、在AndroidManifest-xml中添加如下代码" class="headerlink" title="1、在AndroidManifest.xml中添加如下代码"></a>1、在AndroidManifest.xml中添加如下代码</h4><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"utf-8"</span>?&gt;</span><br><span class="line">&lt;manifest xmlns:android=<span class="string">"http://schemas.android.com/apk/res/android"</span></span><br><span class="line">    ...</span><br><span class="line">    &lt;application</span><br><span class="line">        ...</span><br><span class="line">        &lt;provider</span><br><span class="line">            android:name=<span class="string">"android.support.v4.content.FileProvider"</span></span><br><span class="line">            android:authorities=<span class="string">"$&#123;applicationId&#125;.provider"</span></span><br><span class="line">            android:exported=<span class="string">"false"</span></span><br><span class="line">            android:grantUriPermissions=<span class="string">"true"</span>&gt;</span><br><span class="line">            &lt;meta-data</span><br><span class="line">                android:name=<span class="string">"android.support.FILE_PROVIDER_PATHS"</span></span><br><span class="line">                android:resource=<span class="string">"@xml/provider_paths"</span>/&gt;</span><br><span class="line">        &lt;/provider&gt;</span><br><span class="line">    &lt;/application&gt;</span><br><span class="line">&lt;/manifest&gt;</span><br></pre></td></tr></table></figure>

<h4 id="2、在res目录下新建一个xml文件夹，并且新建一个provider-paths的xml文件"><a href="#2、在res目录下新建一个xml文件夹，并且新建一个provider-paths的xml文件" class="headerlink" title="2、在res目录下新建一个xml文件夹，并且新建一个provider_paths的xml文件"></a>2、在res目录下新建一个xml文件夹，并且新建一个provider_paths的xml文件</h4><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&lt;?xml version=<span class="string">"1.0"</span> encoding=<span class="string">"utf-8"</span>?&gt;</span><br><span class="line">&lt;paths xmlns:android=<span class="string">"http://schemas.android.com/apk/res/android"</span>&gt;</span><br><span class="line">    &lt;external-path name=<span class="string">"external_files"</span> path=<span class="string">"."</span>/&gt;</span><br><span class="line">&lt;/paths&gt;</span><br></pre></td></tr></table></figure>

<h4 id="3、修改代码"><a href="#3、修改代码" class="headerlink" title="3、修改代码"></a>3、修改代码</h4><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">Uri photoURI = Uri.fromFile(createImageFile());</span><br><span class="line"></span><br><span class="line">变成：</span><br><span class="line"></span><br><span class="line">Uri photoURI = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + <span class="string">".provider"</span>, createImageFile());</span><br></pre></td></tr></table></figure>

<h3 id="2"><a href="#2" class="headerlink" title="2"></a>2</h3><p>除了使用the的解决方案之外FileProvider，还有另一种方法可以解决这个问题。简单的说</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">StrictMode.VmPolicy.Builder builder = <span class="keyword">new</span> StrictMode.VmPolicy.Builder();</span><br><span class="line">StrictMode.setVmPolicy(builder.build());</span><br><span class="line">在Application.onCreate()。</span><br></pre></td></tr></table></figure>

<p>以这种方式，VM忽略文件URI曝光。</p>
<p>builder.detectFileUriExposure()<br>启用文件曝光检查，如果我们不设置VmPolicy，这也是默认行为。<br>正如评论中所提到的，StrictMode是诊断工具，不应该用于此问题。当我在一年前发布此答案时，许多应用程序只能接收文件uris。当我尝试向他们发送FileProvider uri时，它们就崩溃了。这在大多数应用程序中已得到修复，因此我们应该使用FileProvider解决方案。<br>在applcation 初始化<br>该方案由<a href="https://me.csdn.net/tanghongchang123" title="tanghongchang123" target="_blank" rel="noopener">tanghongchang123</a> 提出</p>

        </div>
        
          


  <section class='meta' id="footer-meta">
    <hr>
    <div class='new-meta-box'>
      
        
          <div class="new-meta-item date" itemprop="dateUpdated" datetime="2019-08-26T09:51:18+08:00">
  <a class='notlink'>
    <i class="fas fa-clock" aria-hidden="true"></i>
    <p>最后更新于 2019年8月26日</p>
  </a>
</div>

        
      
        
          
  
  <div class="new-meta-item meta-tags"><a class="tag" href="/tags/android/" rel="nofollow"><i class="fas fa-hashtag" aria-hidden="true"></i>&nbsp;<p>android</p></a></div>


        
      
        
          
  <div class="new-meta-item share -mob-share-list">
  <div class="-mob-share-list share-body">
    
      
        <a class="-mob-share-qq" title="QQ好友" rel="external nofollow noopener noreferrer"
          
          href="http://connect.qq.com/widget/shareqq/index.html?url=https://zyqing.ml/2019/08/26/data/FileProvider (1)/&title=FileUriExposedException | 会飞的猪&summary=android intent跳转其他应用异常1Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/head_portrait.jpg exposed beyond app through ClipData.Item.getUri()"
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/assets@19.1.9/logo/128/qq.png">
          
        </a>
      
    
      
        <a class="-mob-share-qzone" title="QQ空间" rel="external nofollow noopener noreferrer"
          
          href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=https://zyqing.ml/2019/08/26/data/FileProvider (1)/&title=FileUriExposedException | 会飞的猪&summary=android intent跳转其他应用异常1Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/head_portrait.jpg exposed beyond app through ClipData.Item.getUri()"
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/assets@19.1.9/logo/128/qzone.png">
          
        </a>
      
    
      
        <a class="-mob-share-weibo" title="微博" rel="external nofollow noopener noreferrer"
          
          href="http://service.weibo.com/share/share.php?url=https://zyqing.ml/2019/08/26/data/FileProvider (1)/&title=FileUriExposedException | 会飞的猪&summary=android intent跳转其他应用异常1Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/head_portrait.jpg exposed beyond app through ClipData.Item.getUri()"
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/assets@19.1.9/logo/128/weibo.png">
          
        </a>
      
    
  </div>
</div>



        
      
    </div>
  </section>


        
        
            <div class="prev-next">
                
                    <section class="prev">
                        <span class="art-item-left">
                            <h6><i class="fas fa-chevron-left" aria-hidden="true"></i>&nbsp;上一页</h6>
                            <h4>
                                <a href="/2019/08/26/data/fastAndroid/" rel="prev" title="android快速开发">
                                  
                                      android快速开发
                                  
                                </a>
                            </h4>
                            
                                
                                <h6 class="tags">
                                    <a class="tag" href="/tags/android快速开发/"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>android快速开发</a> <a class="tag" href="/tags/测试标签/"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>测试标签</a>
                                </h6>
                            
                        </span>
                    </section>
                
                
                    <section class="next">
                        <span class="art-item-right" aria-hidden="true">
                            <h6>下一页&nbsp;<i class="fas fa-chevron-right" aria-hidden="true"></i></h6>
                            <h4>
                                <a href="/2018/07/09/hello-world/" rel="prev" title="Hello World">
                                    
                                        Hello World
                                    
                                </a>
                            </h4>
                            
                        </span>
                    </section>
                
            </div>
        
      </section>
    </article>
  

  
    <!-- 显示推荐文章和评论 -->



  <article class="post white-box comments">
    <section class="article typo">
      <h4><i class="fas fa-comments fa-fw" aria-hidden="true"></i>&nbsp;评论</h4>
      
      
      
      
        <section id="comments">
          <div id="valine_container" class="valine_thread">
            <i class="fas fa-spinner fa-spin fa-fw"></i>
          </div>
        </section>
      
    </section>
  </article>


  




<!-- 根据页面mathjax变量决定是否加载MathJax数学公式js -->



  <script>
    window.subData = {
      title: 'FileUriExposedException',
      tools: true
    }
  </script>


</div>
<aside class='l_side'>
  
    
    
      
        
          
          
            <section class='widget author'>
  <div class='content material'>
    
      <div class='avatar'>
        <img class='avatar' src='http://zy_qing.gitee.io/resources/img/touxiang.jpg'/>
      </div>
    
     
      <div class='text'>
        
        
        
          <p><span id="jinrishici-sentence">柳暗花明又一村</span></p>
          <script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
        
      </div>
    
    
      <div class="social-wrapper">
        
          
            <a href="mailto:1091425078@qq.com"
              class="social fas fa-envelope flat-btn"
              target="_blank"
              rel="external nofollow noopener noreferrer">
            </a>
          
        
          
            <a href="https://github.com/YongQingAndroid"
              class="social fab fa-github flat-btn"
              target="_blank"
              rel="external nofollow noopener noreferrer">
            </a>
          
        
          
            <a href="https://music.163.com/#/user/home?id=343100855"
              class="social fas fa-headphones-alt flat-btn"
              target="_blank"
              rel="external nofollow noopener noreferrer">
            </a>
          
        
      </div>
    
  </div>
</section>

          
        
      
        
          
          
            <section class='widget list'>
  
<header class='material'>
  <div><i class="fas fa-map-signs fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;常用功能</div>
  
</header>

  <div class='content material'>
    <ul class="entry">
      
        <li><a class="flat-box" title="https://dev.tencent.com/u/zyqandroid/p/blog/git" href="https://dev.tencent.com/u/zyqandroid/p/blog/git"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-clock fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;我的GIT
          </div>
          
        </a></li>
      
        <li><a class="flat-box" title="/markPage/" href="/markPage/"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-archive fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;本地markDown工具
          </div>
          
        </a></li>
      
        <li><a class="flat-box" title="/2md/" href="/2md/"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-book fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;HTML转MD
          </div>
          
        </a></li>
      
        <li><a class="flat-box" title="http://zy_qing.gitee.io/resources/" href="http://zy_qing.gitee.io/resources/"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-archive fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;备用markDown工具
          </div>
          
        </a></li>
      
    </ul>
  </div>
</section>

          
        
      
        
          
          
            
  <section class='widget toc-wrapper'>
    
<header class='material'>
  <div><i class="fas fa-list fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;本文目录</div>
  
    <div class='wrapper'><a class="s-toc rightBtn" rel="external nofollow noopener noreferrer" href="javascript:void(0)"><i class="fas fa-thumbtack fa-fw"></i></a></div>
  
</header>

    <div class='content material'>
      <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#android-intent跳转其他应用异常"><span class="toc-text">android intent跳转其他应用异常</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#原因"><span class="toc-text">原因</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#两种解决方案"><span class="toc-text">两种解决方案</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1使用FileProvider"><span class="toc-text">1使用FileProvider</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1、在AndroidManifest-xml中添加如下代码"><span class="toc-text">1、在AndroidManifest.xml中添加如下代码</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2、在res目录下新建一个xml文件夹，并且新建一个provider-paths的xml文件"><span class="toc-text">2、在res目录下新建一个xml文件夹，并且新建一个provider_paths的xml文件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3、修改代码"><span class="toc-text">3、修改代码</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2"><span class="toc-text">2</span></a></li></ol></li></ol></li></ol>
    </div>
  </section>


          
        
      
        
          
          
            <section class='widget list'>
  
<header class='material'>
  <div><i class="fas fa-map-signs fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;站内导航</div>
  
</header>

  <div class='content material'>
    <ul class="entry">
      
        <li><a class="flat-box" title="/" href="/"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-clock fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;近期文章
          </div>
          
        </a></li>
      
        <li><a class="flat-box" title="/blog/archives/" href="/blog/archives/"
          
            rel="nofollow"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-archive fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;文章归档
          </div>
          
        </a></li>
      
        <li><a class="flat-box" title="/projects/" href="/projects/"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-code-branch fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;开源项目
          </div>
          
        </a></li>
      
        <li><a class="flat-box" title="/friends/" href="/friends/"
          
            rel="nofollow"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-link fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;我的友链
          </div>
          
        </a></li>
      
        <li><a class="flat-box" title="/about/" href="/about/"
          
            rel="nofollow"
          
          
          >
          <div class='name'>
            
              <i class="fas fa-info-circle fa-fw" aria-hidden="true"></i>
            
            &nbsp;&nbsp;关于我
          </div>
          
        </a></li>
      
    </ul>
  </div>
</section>

          
        
      
        
          
          
            
  <section class='widget category'>
    
<header class='material'>
  <div><i class="fas fa-folder-open fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;文章分类</div>
  
    <a class="rightBtn"
    
      rel="nofollow"
    
    
    href="/blog/categories/"
    title="blog/categories/">
    <i class="fas fa-expand-arrows-alt fa-fw"></i></a>
  
</header>

    <div class='content material'>
      <ul class="entry">
        
          <li><a class="flat-box" title="/categories/Android/" href="/categories/Android/"><div class='name'>Android</div><div class='badge'>(6)</div></a></li>
        
          <li><a class="flat-box" title="/categories/教程/" href="/categories/教程/"><div class='name'>教程</div><div class='badge'>(1)</div></a></li>
        
      </ul>
    </div>
  </section>


          
        
      
        
          
          
            
  <section class='widget tagcloud'>
    
<header class='material'>
  <div><i class="fas fa-fire fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;热门标签</div>
  
    <a class="rightBtn"
    
      rel="nofollow"
    
    
    href="/blog/tags/"
    title="blog/tags/">
    <i class="fas fa-expand-arrows-alt fa-fw"></i></a>
  
</header>

    <div class='content material'>
      <a href="/tags/android/" style="font-size: 14px; color: #999">android</a> <a href="/tags/android快速开发/" style="font-size: 24px; color: #555">android快速开发</a> <a href="/tags/hook/" style="font-size: 19px; color: #777">hook</a> <a href="/tags/rxjava/" style="font-size: 14px; color: #999">rxjava</a> <a href="/tags/测试标签/" style="font-size: 19px; color: #777">测试标签</a>
    </div>
  </section>


          
        
      
        
          
          
            


  <section class='widget music'>
    
<header class='material'>
  <div><i class="fas fa-compact-disc fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;最近在听</div>
  
    <a class="rightBtn"
    
      rel="external nofollow noopener noreferrer"
    
    
      target="_blank"
    
    href="https://music.163.com/#/user/home?id=343100855"
    title="https://music.163.com/#/user/home?id=343100855">
    <i class="far fa-heart fa-fw"></i></a>
  
</header>

    <div class='content material'>
      
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.7.0/dist/APlayer.min.css">
  <div class="aplayer"
    data-theme="#1BCDFC"
    
    
    data-mode="circulation"
    data-server="netease"
    data-type="playlist"
    data-id="481100619"
    data-volume="0.7">
  </div>
  <script src="https://cdn.jsdelivr.net/npm/aplayer@1.7.0/dist/APlayer.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/meting@1.1.0/dist/Meting.min.js"></script>


    </div>
  </section>


          
        
      
    

  
</aside>

<footer id="footer" class="clearfix">
  
  
    <div class="social-wrapper">
      
        
          <a href="mailto:1091425078@qq.com"
            class="social fas fa-envelope flat-btn"
            target="_blank"
            rel="external nofollow noopener noreferrer">
          </a>
        
      
        
          <a href="https://github.com/YongQingAndroid"
            class="social fab fa-github flat-btn"
            target="_blank"
            rel="external nofollow noopener noreferrer">
          </a>
        
      
        
          <a href="https://music.163.com/#/user/home?id=343100855"
            class="social fas fa-headphones-alt flat-btn"
            target="_blank"
            rel="external nofollow noopener noreferrer">
          </a>
        
      
    </div>
  
  <br>
  <div><p>博客内容遵循 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议</a></p>
</div>
  <div>
    本站使用
    <a href="https://xaoxuu.com/wiki/material-x/" target="_blank" class="codename">Material X</a>
    作为主题
    
      ，
      总访问量为
      <span id="busuanzi_value_site_pv"><i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span>
      次
    
    。
  </div>
  <!-- 血小板 -->
  <div id="landlord">
      <div class="message" style="opacity:0"></div>
      <canvas id="live2d" width="560" height="500" class="live2d"></canvas>
      <div class="hide-button">隐藏</div>
  </div>
</footer>
<script>setLoadingBarProgress(80);</script>
<!-- live2d 血小板 -->
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
    var message_Path = '/live2d/'
    var home_Path = 'https://haremu.com/'
</script>
<script type="text/javascript" src="/live2d/js/live2d.js"></script>
<script type="text/javascript" src="/live2d/js/message.js"></script>
<script type="text/javascript">
    loadlive2d("live2d", "/live2d/model/xiaoban/model.json");
</script>


      <script>setLoadingBarProgress(60);</script>
    </div>
    <a class="s-top fas fa-arrow-up fa-fw" href='javascript:void(0)'></a>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>

  <script>
    var GOOGLE_CUSTOM_SEARCH_API_KEY = "";
    var GOOGLE_CUSTOM_SEARCH_ENGINE_ID = "";
    var ALGOLIA_API_KEY = "";
    var ALGOLIA_APP_ID = "";
    var ALGOLIA_INDEX_NAME = "";
    var AZURE_SERVICE_NAME = "";
    var AZURE_INDEX_NAME = "";
    var AZURE_QUERY_KEY = "";
    var BAIDU_API_ID = "";
    var SEARCH_SERVICE = "hexo" || "hexo";
    var ROOT = "/"||"/";
    if(!ROOT.endsWith('/'))ROOT += '/';
  </script>

<script src="//instant.page/1.2.2" type="module" integrity="sha384-2xV8M5griQmzyiY3CDqh1dn4z3llDVqZDqzjzcY+jCBCk/a5fXJmuZ/40JJAPeoU"></script>


  <script async src="https://cdn.jsdelivr.net/npm/scrollreveal@4.0.5/dist/scrollreveal.min.js"></script>
  <script type="text/javascript">
    $(function() {
      const $reveal = $('.reveal');
      if ($reveal.length === 0) return;
      const sr = ScrollReveal({ distance: 0 });
      sr.reveal('.reveal');
    });
  </script>


  <script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script>
  <script type="text/javascript">
    $(function() {
      Waves.attach('.flat-btn', ['waves-button']);
      Waves.attach('.float-btn', ['waves-button', 'waves-float']);
      Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
      Waves.attach('.flat-box', ['waves-block']);
      Waves.attach('.float-box', ['waves-block', 'waves-float']);
      Waves.attach('.waves-image');
      Waves.init();
    });
  </script>


  <script async src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js"></script>












  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  
    
      <script src="https://cdn.jsdelivr.net/gh/xaoxuu/volantis@1.0/js/volantis.min.js"></script>
    
  
  <script>
  var GUEST_INFO = ['nick','mail','link'];
  var guest_info = 'nick,mail,link'.split(',').filter(function(item){
    return GUEST_INFO.indexOf(item) > -1
  });
  var notify = 'true' == true;
  var verify = 'true' == true;
  var valine = new Valine();
  valine.init({
    el: '#valine_container',
    notify: notify,
    verify: verify,
    guest_info: guest_info,
    
    appId: "nbvwRDSIj9302hYN0p3EgCgT-gzGzoHsz",
    appKey: "XVOUM8qKVsqegg2TnN7sHpMQ",
    placeholder: "快来评论吧~",
    pageSize:'10',
    avatar:'mp',
    lang:'zh-cn',
    highlight:'true'
  })
  </script>



  <script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.5/js/app.js"></script>


  <script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.5/js/search.js"></script>




<!-- 复制 -->
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  let COPY_SUCCESS = "复制成功";
  let COPY_FAILURE = "复制失败";
  /*页面载入完成后，创建复制按钮*/
  !function (e, t, a) {
    /* code */
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '  <i class="fa fa-copy"></i><span>复制</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });

      clipboard.on('success', function(e) {
        //您可以加入成功提示
        console.info('Action:', e.action);
        console.info('Text:', e.text);
        console.info('Trigger:', e.trigger);
        success_prompt(COPY_SUCCESS);
        e.clearSelection();
      });
      clipboard.on('error', function(e) {
        //您可以加入失败提示
        console.error('Action:', e.action);
        console.error('Trigger:', e.trigger);
        fail_prompt(COPY_FAILURE);
      });
    }
    initCopyCode();

  }(window, document);

  /**
   * 弹出式提示框，默认1.5秒自动消失
   * @param message 提示信息
   * @param style 提示样式，有alert-success、alert-danger、alert-warning、alert-info
   * @param time 消失时间
   */
  var prompt = function (message, style, time)
  {
      style = (style === undefined) ? 'alert-success' : style;
      time = (time === undefined) ? 1500 : time*1000;
      $('<div>')
          .appendTo('body')
          .addClass('alert ' + style)
          .html(message)
          .show()
          .delay(time)
          .fadeOut();
  };

  // 成功提示
  var success_prompt = function(message, time)
  {
      prompt(message, 'alert-success', time);
  };

  // 失败提示
  var fail_prompt = function(message, time)
  {
      prompt(message, 'alert-danger', time);
  };

  // 提醒
  var warning_prompt = function(message, time)
  {
      prompt(message, 'alert-warning', time);
  };

  // 信息提示
  var info_prompt = function(message, time)
  {
      prompt(message, 'alert-info', time);
  };

</script>


<!-- fancybox -->
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
<script>
  let LAZY_LOAD_IMAGE = "";
  $(".article-entry").find("fancybox").find("img").each(function () {
      var element = document.createElement("a");
      $(element).attr("data-fancybox", "gallery");
      $(element).attr("href", $(this).attr("src"));
      /* 图片采用懒加载处理时,
       * 一般图片标签内会有个属性名来存放图片的真实地址，比如 data-original,
       * 那么此处将原本的属性名src替换为对应属性名data-original,
       * 修改如下
       */
       if (LAZY_LOAD_IMAGE) {
         $(element).attr("href", $(this).attr("data-original"));
       }
      $(this).wrap(element);
  });
</script>





  <script>setLoadingBarProgress(100);</script>

</body>
</html>
<!--单击显示文字-->
<script type="text/javascript" src="/js/click_show_text.js"></script>

